<%@ page import="java.io.*, java.net.*" %>
<%--
this is a VERY simple proxy intended for XML services.. totally insecure

@param url  - url is a request param indicating the remote url to proxy...
@return     - byte for byte proxy of the requested url with the
              response mime-type set to text/xml
--%>
<%
String url = request.getParameter("url");
System.out.println("url = " + url);

response.setContentType("text/xml");
OutputStream responseOut = response.getOutputStream();

InputStream responseIn = null;
try {
    responseIn = new URL(url).openStream();
    byte[] buf = new byte[4096];
    int byteCount;
    while ((byteCount = responseIn.read(buf)) != -1) {
        responseOut.write(buf, 0, byteCount);
    }
} catch (Exception e) { e.printStackTrace();
} finally {
    try {
        responseOut.flush();
        responseOut.close();
        responseIn.close();
    } catch (Exception e) { e.printStackTrace(); }
}
%>